package com.avic.rong.goodsSort.api;

import com.avic.rong.api.HttpPostService;
import com.avic.rong.utils.ConstantsUtils;
import com.example.minato.minastore.BaseApi;
import com.example.minato.minastore.listener.HttpOnNextListener;
import com.orhanobut.logger.Logger;
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;

import io.reactivex.Observable;
import retrofit2.Retrofit;

/**
 * Created by Chenjiaxin on 2019/7/24 14:10
 * E-Mail Address：16601203965@163.com
 */
public class StandardSearchApi extends BaseApi {

    private int types;
    private Integer typeId;
    private String keyword = ConstantsUtils.EMPTY_STR;
    private int sort = 0;
    private String catIds = ConstantsUtils.EMPTY_STR;
    private String attrPro = ConstantsUtils.EMPTY_STR;
    private int pageNo = 1;

    public void setCatIds(String catIds) {
        this.catIds = catIds;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

    public void setSort(int sort) {
        this.sort = sort;
    }

    public void setAttrPro(String attrPro) {
        this.attrPro = attrPro;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    public StandardSearchApi(RxAppCompatActivity rxAppCompatActivity, HttpOnNextListener listener) {
        super(rxAppCompatActivity, listener);
        setCache(false);
    }

    public void setArgument(int types, Integer typeId, int sort) {
        this.types = types;
        this.typeId = typeId;
        this.sort = sort;
    }

    public void setArgument(int types, Integer typeId, int sort, String keyword,String catIds, String attrPro) {
        this.types = types;
        this.typeId = typeId;
        this.sort = sort;
        this.keyword = keyword;
        this.catIds = catIds;
        this.attrPro = attrPro;
    }

    public void setTypes(int types) {
        this.types = types;
    }

    @Override
    public Observable getObservable(Retrofit retrofit) {
        HttpPostService service = retrofit.create(HttpPostService.class);
        Logger.i(types + "--------------catIds:--" + catIds + "-----attrPro:" + attrPro + "----typeId:" + typeId + "----pageNo:" + pageNo + "-----keyword:" + keyword);
        return service.searchStandardAll(types, typeId, sort, keyword, catIds, attrPro, pageNo);
    }


}
